package com.woniu.communitymanagement.controller;

import com.woniu.communitymanagement.entity.HttpResult;
import com.woniu.communitymanagement.entity.PropertyInfo;
import com.woniu.communitymanagement.service.IPropertyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/proInfo")
@CrossOrigin(origins = "*")
public class ProInfoController {

    @Autowired
    private IPropertyInfoService ps;

    @RequestMapping("/list")
    public HttpResult getProInfoList(String numbers, String status, int pageIndex, int pageSize){
        return ps.getProInfoList(numbers, status, pageIndex, pageSize);
    }

    @PostMapping("/add")
    public HttpResult addProInfo(@RequestBody PropertyInfo propertyInfo){
        return ps.addProInfo(propertyInfo);
    }

    @RequestMapping("/remove")
    public HttpResult removeProInfo(int id){
        return ps.removeProInfo(id);
    }

    @PostMapping("/update")
    HttpResult updateProInfo(@RequestBody PropertyInfo propertyInfo){
        return ps.updateProInfo(propertyInfo);
    }

    @RequestMapping("/info")
    HttpResult getInfoById(int id){
        return ps.getInfoById(id);
    }

}
